
const nodemailer = require('nodemailer')

let transporter = nodemailer.createTransport({
    host: 'smtp.163.com',
    secure: true,
    auth: {
        user: "18143770719@163.com",
        pass: "PSCECQOXNKEZKEBC" 
    }
});

module.exports = function fn(email, code){
    return new Promise((resolve, reject) => {
        transporter.sendMail({
            from: "18143770719@163.com",
            to: email, 
            subject: '网易邮箱账号注册登录',
            html: `
            <p>网站账户注册验证码：</p>
        <span style="font-size: 18px; color: red">` + code + `</span>`

        }, function (err, info) {
            if (err) {
                reject(err)
            } else {
                resolve(info)
            }
        });
    })
}


